package websimulator;

import java.io.IOException;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;

@SuppressWarnings("serial")
@WebServlet("/posting")
public class Main extends HttpServlet
{
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{		
		OutputStream out = response.getOutputStream();
		response.setContentType("text/html");
		JFreeChart chart = Simulation.calculate();
		ChartUtilities.writeChartAsPNG(out, chart, 500, 500);
	}
}
